<template>
  <div class="ongoing-wrapp">
    <task-header></task-header>
    <task-list
    :tableData="tableData"
    :RowClick="tableRowClick"
    :task_finish="task_finish"
    :task_sign="task_sign"
    :task_delay="task_delay"
    :task_del="task_del">
    </task-list>
    <transition name="fade">
      <task-dialog
      ref="taskDialog"
      v-if="taskDialogVisible && propsData"
      :taskDialogVisible.sync="taskDialogVisible"
      :propsData="propsData"
      :propTimeAxisDtos = "propTimeAxisDtos"
      :propUserInfoDto = "propUserInfoDto"
      :propCusForms = "propCusForms"
      :headBind="headBind">
    </task-dialog>
    </transition>
  </div>
</template>
<script>
import taskList from '@/components/task-list/task_list'
import taskDialog from '@/components/task-dialog/task_dialog'
import taskHeader from '@/components/task-header/task_header'

export default {
  data(){
    return{
      taskDialogVisible:false,
      value: '',
      tableIndex:'',
      tableData: [],
      propsData:''
    }
  },
  methods:{
    task_finish(val){
      alert(val)
    },
    task_sign(val){
      alert(val)
    },
    task_delay(val){
      alert(val)
    },
    task_del(val){
      alert(val)
    },
    headBind(nodeId,taskId,procInstanceId){
      let params = {
        "data": {
          "nodeId":nodeId,
          "taskId":taskId,
          "procInstanceId":procInstanceId
        }
      }
      this.$post("/custom/detail",params,data => {
          this.$refs.taskDialog.setCusForms(data.data.cusForms);
        },error => {
          alert("请求出错");
      });
    },
    tableMouseEnter(row, column, cell, event){
        // this.tableIndex = row.taskId;
        console.log(row)
    },
    tableMouseLeave(){
        this.tableIndex = ""
    },
    tableRowClick(row, event, column){
      this.taskDialogVisible = true;
      console.log("点击table获取的数据",row);
      let params = {
        assignUserId:"",
           backlogId:row.backlogId,
           menuType:0,
           nodeId:row.nodeId,
           procInstanceId:row.procInstanceId,
           taskId:row.taskId
      }
      this.get_ongoingTimeShaft(params);
    },
    get_ongoingData(){
      let params = {
          taskStatus:10
      }
      this.$post("/procdef/queryMyCarryOutOrFinshTask",params,data => {
         console.log("任务表单数据",data.data);
         this.tableData = data.data;
        },error => {
          console.log("请求出错");
      });
    },
    get_ongoingTimeShaft(val){
      let params = {
        "data": val
      }
      this.$post("/backlogTask/queryTaskTimeAxis",params,data => {
         console.log("获取时间轴数据",data.data);
         this.propTimeAxisDtos = data.data.timeAxisDtos;
         this.propUserInfoDto = data.data.userInfoDto;
         this.propCusForms = data.data.detail.cusForms;
         this.propsData = data.data;
        },error => {
          console.log("请求出错");
      });
    }
  },
  created(){
     this.get_ongoingData();
  },
  components:{
    taskList,
    taskDialog,
    taskHeader
  }
}
</script>
<style scoped lang="scss">
.fade-enter-active, .fade-leave-active {
transition: opacity .3s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
</style>
